package com.supermarket.mapper;

import com.supermarket.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

@Mapper
public interface UserMapper {
    /**
     * 根据用户名查询数据
     * @param username
     * @return
     */
    User selectByUserName(String username);

    /**
     * 用户列表查询
     * @param username
     * @param phone
     * @return
     */
    List<User> queryUserList(String username, String phone);

    /**
     * 添加员工
     * @param user
     */
    void addUser(User user);

    /**
     * 根据id修改用户
     * @param user
     */
    void updateUser(User user);

    @Delete("delete from user where  id=#{id}")
    void deleteUserById(Long id);

    @Select("select * from user where id=#{id}")
    User getUserById(Long id);
}
